/* 全局表格样式基线 - 解决表头与内容错位问题 */

:root {
  --scrollbar-width: 0px;
}

/* 基础表格容器 */
.base-table-wrapper {
  overflow: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 基础表格样式 */
.base-table {
  width: 100%;
}

.base-table .ant-table {
  border-collapse: collapse;
  table-layout: fixed !important;
}

/* 表头样式 */
.base-table .ant-table-thead > tr > th {
  background: #fafafa !important;
  border-bottom: 1px solid #eee !important;
  padding: 12px 16px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-sizing: border-box !important;
  background-clip: padding-box !important;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* 表体样式 */
.base-table .ant-table-tbody > tr > td {
  border-bottom: 1px solid #eee !important;
  padding: 12px 16px !important;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-sizing: border-box !important;
  background-clip: padding-box !important;
}

/* 滚动条补偿 - 仅在需要时应用 */
.base-table .ant-table-thead > tr > th:last-child {
  padding-right: calc(16px + var(--scrollbar-width));
}

/* 单元格类型样式 */
.base-table-cell.cell--image {
  text-align: center;
}

.base-table-cell.cell--image img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

.base-table-cell.cell--actions {
  text-align: right;
}

.base-table-cell.cell--rating,
.base-table-cell.cell--stock,
.base-table-cell.cell--sales,
.base-table-cell.cell--hot {
  text-align: center;
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .base-table-cell.cell--description {
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
  }
  
  .base-table-cell.cell--coupon-info {
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
  }
}

/* 禁用列调整 */
.base-table .ant-table-thead > tr > th .ant-table-column-sorter {
  right: 8px;
}

/* 确保表格内容不会因为图片加载而抖动 */
.base-table .ant-table-tbody > tr > td img {
  display: block;
}

/* 空状态和加载状态样式 */
.base-table .ant-table-placeholder {
  border-bottom: none;
}

.base-table .ant-spin-nested-loading > div > .ant-spin {
  max-height: none;
}

/* Resizable columns styles */
.react-resizable {
  position: relative;
  background-clip: padding-box;
}

.react-resizable-handle {
  position: absolute;
  right: -5px;
  bottom: 0;
  z-index: 1;
  width: 10px;
  height: 100%;
  cursor: col-resize;
}